<?php

namespace App\Validate;

use App\Validate\BaseValidate;

/**
 * 视频资源管理
 */
class ResourceVideoInfoValidate extends  BaseValidate
{
    //验证规则
    protected $rule = [
        'id' => 'bail|required|integer',
        'img' => 'bail|required',
        'type_id' => 'bail|required|integer',
        'path' => 'bail|required',
        'size' => 'bail|required|integer',
        'chapter_id' => 'bail|required|integer',
        'title' => 'bail|required',
        'content' => 'bail|required',

        'guid' => 'bail|required|size:32',
        'guids' => 'bail|required',
        'is_play' => 'required|integer|in:1,2',
    ];
    //自定义验证信息
    protected $message = [
        'id.required' => 'ID不能为空',
        'id.integer' => 'ID格式不正确',

        'img.required' => '图片不能为空',
        'type_id.required' => '类型ID不能为空',
        'type_id.integer' => '类型ID格式不正确',
        'chapter_id.required' => '章节ID不能为空',
        'chapter_id.integer' => '章节ID格式不正确',
        'title.required' => '标题不能为空',
        'content.required' => '内容不能为空',

        'path.required' => '资源地址不能为空',
        'size.required' => '资源大小不能为空',
        'size.integer' => '资源大小格式不正确',

        'guid.required' => 'ID不能为空',
        'guid.size' => 'ID格式不正确',
        'guids.required' => 'ID不能为空',


        "is_play.required" => "状态不能为空",
        "is_play.integer" => "状态参数错误",
        "is_play.in" => "状态参数错误",
    ];


    //自定义场景
    protected $scene = [
        'detail' => ['guid'], //详情
        'add' => ['img', 'title', 'type_id'], //添加
        'change' => ['guid', 'img', 'title', 'type_id'], //修改
        'del' => ['guid'], //删除
        'cancel_and_release' => ['guids', 'is_play'], //撤销 和发布





    ];
}
